// ==========================================================================
// GFast自动生成model操作代码。
// 生成日期：2024-11-11 20:33:48
// 生成路径: internal/app/system/model/addresses.go
// 生成人：王中阳
// desc:收货地址
// company:云南奇讯科技有限公司
// ==========================================================================

package model

import (
	"github.com/gogf/gf/v2/os/gtime"
	"github.com/gogf/gf/v2/util/gmeta"
	comModel "github.com/tiger1103/gfast/v3/internal/app/common/model"
)

// AddressesInfoRes is the golang structure for table addresses.
type AddressesInfoRes struct {
	gmeta.Meta     `orm:"table:addresses"`
	Id             int                     `orm:"id,primary" json:"id" dc:""`     //
	Userid         int                     `orm:"userid" json:"userid" dc:"用户id"` // 用户id
	LinkedUserid   *LinkedAddressesUsers   `orm:"with:id=userid" json:"linkedUserid"`
	Name           string                  `orm:"name" json:"name" dc:"姓名"`            // 姓名
	Phone          string                  `orm:"phone" json:"phone" dc:"手机号"`         // 手机号
	SchoolId       int                     `orm:"school_id" json:"schoolId" dc:"学校id"` // 学校id
	LinkedSchoolId *LinkedAddressesSchools `orm:"with:id=school_id" json:"linkedSchoolId"`
	Addr           string                  `orm:"addr" json:"addr" dc:"地图选点地址"`          // 地图选点地址
	Detail         string                  `orm:"detail" json:"detail" dc:"详细地址"`        // 详细地址
	AddrName       string                  `orm:"addr_name" json:"addrName" dc:"粘贴板内容"`  // 粘贴板内容
	Lat            string                  `orm:"lat" json:"lat" dc:"经度"`                // 经度
	Lng            string                  `orm:"lng" json:"lng" dc:"纬度"`                // 纬度
	IsDel          int                     `orm:"is_del" json:"isDel" dc:"是否删除"`         // 是否删除
	IsDefault      int                     `orm:"is_default" json:"isDefault" dc:"是否默认"` // 是否默认
	CreatedAt      *gtime.Time             `orm:"created_at" json:"createdAt" dc:""`     //
	UpdatedAt      *gtime.Time             `orm:"updated_at" json:"updatedAt" dc:""`     //
}
type LinkedAddressesUsers struct {
	gmeta.Meta `orm:"table:users"`
	Id         int    `orm:"id" json:"id" dc:""`             //
	Username   string `orm:"username" json:"username" dc:""` //
}

type LinkedAddressesSchools struct {
	gmeta.Meta `orm:"table:schools"`
	Id         int    `orm:"id" json:"id" dc:""`                 //
	Schoolname string `orm:"schoolname" json:"schoolname" dc:""` //
}

type AddressesListRes struct {
	Id             int                     `json:"id" dc:""`
	Userid         int                     `json:"userid" dc:"用户id"`
	LinkedUserid   *LinkedAddressesUsers   `orm:"with:id=userid" json:"linkedUserid" dc:"用户id"`
	Name           string                  `json:"name" dc:"姓名"`
	Phone          string                  `json:"phone" dc:"手机号"`
	SchoolId       int                     `json:"schoolId" dc:"学校id"`
	LinkedSchoolId *LinkedAddressesSchools `orm:"with:id=school_id" json:"linkedSchoolId" dc:"学校id"`
	Addr           string                  `json:"addr" dc:"地图选点地址"`
	Detail         string                  `json:"detail" dc:"详细地址"`
	AddrName       string                  `json:"addrName" dc:"粘贴板内容"`
	Lat            string                  `json:"lat" dc:"经度"`
	Lng            string                  `json:"lng" dc:"纬度"`
	IsDel          int                     `json:"isDel" dc:"是否删除"`
	IsDefault      int                     `json:"isDefault" dc:"是否默认"`
	CreatedAt      *gtime.Time             `json:"createdAt" dc:""`
}

// AddressesSearchReq 分页请求参数
type AddressesSearchReq struct {
	comModel.PageReq
	Id        string `p:"id" dc:""`                                                       //
	Userid    string `p:"userid" v:"userid@integer#用户id需为整数" dc:"用户id"`                   //用户id
	Name      string `p:"name" dc:"姓名"`                                                   //姓名
	Phone     string `p:"phone" dc:"手机号"`                                                 //手机号
	SchoolId  string `p:"schoolId" v:"schoolId@integer#学校id需为整数" dc:"学校id"`               //学校id
	Addr      string `p:"addr" dc:"地图选点地址"`                                               //地图选点地址
	Detail    string `p:"detail" dc:"详细地址"`                                               //详细地址
	AddrName  string `p:"addrName" dc:"粘贴板内容"`                                            //粘贴板内容
	Lat       string `p:"lat" dc:"经度"`                                                    //经度
	Lng       string `p:"lng" dc:"纬度"`                                                    //纬度
	IsDel     string `p:"isDel" v:"isDel@integer#是否删除需为整数" dc:"是否删除"`                     //是否删除
	IsDefault string `p:"isDefault" v:"isDefault@integer#是否默认需为整数" dc:"是否默认"`             //是否默认
	CreatedAt string `p:"createdAt" v:"createdAt@datetime#需为YYYY-MM-DD hh:mm:ss格式" dc:""` //
}

// AddressesSearchRes 列表返回结果
type AddressesSearchRes struct {
	comModel.ListRes
	List []*AddressesListRes `json:"list"`
}

// 相关连表查询数据
type LinkedAddressesDataSearchRes struct {
	LinkedAddressesUsers   []*LinkedAddressesUsers   `json:"linkedAddressesUsers"`
	LinkedAddressesSchools []*LinkedAddressesSchools `json:"linkedAddressesSchools"`
}

// AddressesAddReq 添加操作请求参数
type AddressesAddReq struct {
	Userid    int    `p:"userid"  dc:"用户id"`
	Name      string `p:"name" v:"required#姓名不能为空" dc:"姓名"`
	Phone     string `p:"phone" v:"required#手机号不能为空" dc:"手机号"`
	SchoolId  int    `p:"schoolId"  dc:"学校id"`
	Addr      string `p:"addr"  dc:"地图选点地址"`
	Detail    string `p:"detail"  dc:"详细地址"`
	AddrName  string `p:"addrName" v:"required#粘贴板内容不能为空" dc:"粘贴板内容"`
	Lat       string `p:"lat"  dc:"经度"`
	Lng       string `p:"lng"  dc:"纬度"`
	IsDel     int    `p:"isDel"  dc:"是否删除"`
	IsDefault int    `p:"isDefault"  dc:"是否默认"`
}

// AddressesEditReq 修改操作请求参数
type AddressesEditReq struct {
	Id        int    `p:"id" v:"required#主键ID不能为空" dc:""`
	Userid    int    `p:"userid"  dc:"用户id"`
	Name      string `p:"name" v:"required#姓名不能为空" dc:"姓名"`
	Phone     string `p:"phone" v:"required#手机号不能为空" dc:"手机号"`
	SchoolId  int    `p:"schoolId"  dc:"学校id"`
	Addr      string `p:"addr"  dc:"地图选点地址"`
	Detail    string `p:"detail"  dc:"详细地址"`
	AddrName  string `p:"addrName" v:"required#粘贴板内容不能为空" dc:"粘贴板内容"`
	Lat       string `p:"lat"  dc:"经度"`
	Lng       string `p:"lng"  dc:"纬度"`
	IsDel     int    `p:"isDel"  dc:"是否删除"`
	IsDefault int    `p:"isDefault"  dc:"是否默认"`
}
